package com.example.android.fragments

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.lifecycleScope
import com.example.android.R
import com.example.android.activities.MainActivity
import com.example.android.extensions.Services
import com.example.android.models.Announce
import com.example.android.viewmodels.AnnounceViewModel
import kotlinx.coroutines.launch

// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"

/**
 * @ClassName AnnounceContentFragment
 * @Author Ryan Kamanri
 * @Date 2022/6/1
 * @Description
 **/
class AnnounceContentFragment(val _Announce: Announce) : Fragment() {


    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_announce_content, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        // 放置数据
        view.findViewById<TextView>(R.id.announce_content_title).text = _Announce.title
        view.findViewById<TextView>(R.id.announce_content_time).text = _Announce.time
        view.findViewById<TextView>(R.id.announce_content_content).text = _Announce.content

        (requireActivity() as MainActivity).SetCheckCanDoRefresh { false }
    }

}